﻿using GamFi.API.Application.Contracts.Purchase.PostBuyToken;
using GamFi.API.Application.Features.Queries.Purchase.PostBuyToken;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GamFi.API.WEB.Controllers;

[Authorize]
[ApiController]
[Route("api/[controller]")]
public class PurchaseController(IMediator mediator): ControllerBase
{
    /// <summary>
    /// Покупка токена
    /// </summary>
    /// <param name="request"></param>
    /// <param name="cancellationToken"></param>
    [HttpPost("BuyToken")]
    public async Task PostBuyToken([FromBody] PostBuyTokenRequest request, CancellationToken cancellationToken)
        => await mediator.Send(new PostBuyTokenCommand(request), cancellationToken);
}